package com.hqyj.controller;

import com.hqyj.pojo.Admin;
import com.hqyj.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;

/**
 * @Description
 * @Autor 伍军
 * @Date 2021/10/9 9:03
 * @Version 1.0
 **/
@RestController
@RequestMapping("/adminRestful")
public class AdminRestFulController {
    @Autowired
    AdminService adminService;
    @RequestMapping("/emailCode")
    public HashMap<String,String> emailCode(Admin a,HttpServletRequest request){
        return adminService.getSendEmailCode(a,request);
    }

    @RequestMapping("/login")
    public HashMap<String,Object> login(Admin a, HttpServletRequest req){
        return adminService.login(a,req);
    }

    //加载表格数据
    @RequestMapping("/adminList")
    public  HashMap<String,Object> listPage(Admin a){
        return adminService.select(a);
    }
    //修改
    @RequestMapping("/update")
    public HashMap<String,Object>  update(Admin a){
        return adminService.update(a);
    }
    //新增
    @RequestMapping("/add")
    public HashMap<String,Object> add( Admin a){
        return adminService.add(a);
    }
    //删除
    @RequestMapping("/del")
    public HashMap<String,Object> del(Integer id){
        return adminService.del(id);
    }

}
